package c.h.a.k0.a;

import android.content.Context;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import c.h.a.m0.h;
import c.h.a.y.a;
import com.liuzh.deviceinfo.tests.TestesActivity;

/* compiled from: VibrationTestFragment */
public class f0 extends a {
    public Vibrator W;
    public View X;

    public void D(Context context) {
        super.D(context);
        ((TestesActivity) context).setTitle(2131690551);
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        this.W = (Vibrator) Z().getSystemService("vibrator");
    }

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        if (this.X == null) {
            View inflate = layoutInflater.inflate(2131493072, viewGroup, false);
            this.X = inflate;
            ImageView imageView = (ImageView) inflate.findViewById(2131296633);
            if (s().getConfiguration().orientation == 2) {
                imageView.setTranslationY((float) (-h.t(45.0f, s().getDisplayMetrics())));
            }
            imageView.setImageResource(2131231123);
            ((TextView) this.X.findViewById(2131296715)).setText(2131690552);
            this.X.findViewById(2131296650).setOnClickListener(new q(this));
            this.X.findViewById(2131296653).setOnClickListener(new r(this));
        }
        return this.X;
    }

    public void N() {
        this.E = true;
        Vibrator vibrator = this.W;
        if (vibrator != null && vibrator.hasVibrator()) {
            this.W.cancel();
        }
    }

    public void P() {
        this.E = true;
        long[] jArr = new long[]{0, 1000, 0};
        Vibrator vibrator = this.W;
        if (vibrator != null && vibrator.hasVibrator()) {
            if (VERSION.SDK_INT >= 26) {
                this.W.vibrate(VibrationEffect.createWaveform(jArr, 0));
            } else {
                this.W.vibrate(jArr, 0);
            }
        }
    }
}
